{include file="common/head_s"/}
<style type="text/css">
.layui-table-view{ margin: 0px!important; }
</style>
<div class="main">  
    <div class="layui-card-header">下级码商订单明细</div> 
    <div class="demoTable pd15 layui-form"> 
        <div class="layui-inline">
            <select name="userid" id="userid" ng-model="field.userid" lay-filter="userid" lay-verify="required">
                <option value="">按下级码商</option>
                {volist name="agentRes" id="vo"}<option value="{$vo.id}" id="{$vo.id}">{$vo.username}</option>  {/volist}
            </select> 
        </div>
        <!-- <div class="layui-inline">
            <select name="shopid" id="shopid" ng-model="field.shopid" lay-filter="shopid" lay-verify="required">
                <option value="">按所属商城</option>
                {volist name="shoplist" id="vo"}<option value="{$vo.id}" id="{$vo.name}">{$vo.name}</option>  {/volist}
            </select> 
        </div> -->
       <!--  <div class="layui-inline">
            <select name="cionid" id="cionid" ng-model="field.cionid" lay-filter="cionid" lay-verify="required">
                <option value="">按所属币种</option>
                {volist name="cionlist" id="vo"}<option value="{$vo.id}">{$vo.name}/{$vo.name_en}</option>{/volist}
            </select>
        </div> -->
        <div class="layui-inline">
            <select name="state" id="state" ng-model="field.state" lay-filter="state" lay-verify="required">
                <option value="">按支付状态</option>
                <option value="-1">待支付</option>
               <!--  <option value="1">待确认</option> -->
                <option value="2">已确认</option> 
            </select>
        </div>
       <!--  <div class="layui-inline">
            <select name="points" id="points" ng-model="field.points" lay-filter="points" lay-verify="required">
                <option value="">按上分状态</option>
                <option value="0">待上分</option>
                <option value="1">自动上分</option>
                <option value="2">手动上分</option>
            </select>
        </div> -->
        <div class="layui-inline"> 
            <input type="text" class="layui-input" id="timess" placeholder="选择日期"> 
        </div>
        <div class="layui-inline">
            <input class="layui-input" name="orderid" id="orderid" placeholder="平台订单号">
        </div>
        <button class="layui-btn layui-btn-primary" id="search" data-type="reload">搜索</button>  
        <button class="layui-btn layui-btn-primary" id="totals" data-type="reload">统计</button>
    </div> 
    <div class="pd15" style="padding-top: 0px;">
       <!--  <blockquote class="layui-elem-quote"><span class="red">待支付：</span>{$payorder.no}元，<span class="blue">待确认：</span>{$payorder.que}元，<span class="gre">已确认：</span>{$payorder.yes}元</blockquote> -->
       <table class="layui-table layui-hide" id="total" lay-filter="totals"></table>
        <br />
        <table class="layui-table layui-hide" id="orderlist" lay-filter="listss"></table>
    </div> 
</div>
<script type="text/html" id="topNav">
    <a href="{:url('orderlist')}" class="layui-btn layui-btn-sm"><i class="layui-icon">&#xe857;</i>全部订单明细</a> 
    <div class="layui-btn layui-btn-sm layui-btn-primary" onclick="orderquan('today')"><i class="layui-icon">&#xe857;</i>今日订单明细</div> 
    <div class="layui-btn layui-btn-sm layui-btn-primary" onclick="orderquan('yesterday')"><i class="layui-icon">&#xe857;</i>昨日订单明细</div> 
    <div class="layui-btn layui-btn-sm layui-btn-primary" onclick="orderquan('week')"><i class="layui-icon">&#xe857;</i>本周订单明细</div> 
    <div class="layui-btn layui-btn-sm layui-btn-primary" onclick="orderquan('last week')"><i class="layui-icon">&#xe857;</i>上周订单明细</div> 
    <div class="layui-btn layui-btn-sm layui-btn-primary" onclick="orderquan('month')"><i class="layui-icon">&#xe857;</i>本月订单明细</div> 
    <div class="layui-btn layui-btn-sm layui-btn-primary" onclick="orderquan('last month')"><i class="layui-icon">&#xe857;</i>上月订单明细</div> 
</script>  
<script type="text/html" id="payinfo">
    {{# if(d.bankid){ }}<div onmouseover="layer.tips('{{d.bank_name}}<br>收款账号：{{d.bank_no}}<br>支付时间：{{d.paytime}}',this,{area: 'auto',tips: [1, '#333']});" onmouseout="layer.closeAll();">{{d.payname}}</div>{{# } }} 
</script> 
<script src="/static/plugins/layui/layui.js"></script> 
<script>
    layui.use(['table','form','laydate'], function() { 
        var table = layui.table,form = layui.form, $ = layui.jquery,laydate = layui.laydate;
        laydate.render({
            elem: '#timess',range: true,type: 'datetime'
        });
        tableIn = table.render({
            id: 'listss',
            elem: '#orderlist',
			toolbar: '#topNav',
            url: '{:url("orderlist")}',
            method: 'post', 
            page: true,
            cols: [[ 
                {field: 'orderid', title: '平台订单号',align: 'center', width:138, fixed: true},
                {field: 'cionname', title: '币种名称',align: 'center', width: 138, fixed: true},
                {field: 'money', title: '订单金额',align: 'center', width: 120, fixed: true}, 
                {field: 'price', title: '单价/CNY',align: 'center', width: 100},
                {field: 'number', title: '数量',align: 'center', width: 100},
                {field: 'state_name', title: '订单状态',align: 'center', width: 100}, 
                {field: 'points_name', title: '上分状态',align: 'center', width: 100}, 
                {field: 'payname', title: '支付信息',align: 'center', width: 100,templet: '#payinfo'}, 
                {field: 'fei_user', title: '手续费',align: 'center', width: 80},  
                {field: 'channelname', title: '所属通道',align: 'center', width: 130}, 
                {field: 'shopname', title: '所属商户',align: 'center', width: 100}, 
                {field: 'orderid_out', title: '商户订单号',align: 'center', width: 150},  
                {field: 'note', title: '备注信息',align: 'center', width: 120},  
                {field: 'addtime', title: '提交时间',align: 'center', width: 160},  
            ]],
            limit: 10 //每页默认显示的数量
        });  
        //搜索
        $('#search').on('click', function() {
            var shopid = $('#shopid').val();
            var cionid = $('#cionid').val();
            var timess = $('#timess').val();
            var state = $('#state').val();
            var points = $('#points').val();
            var orderid = $('#orderid').val();
            var userid = $('#userid').val();
            if($.trim(shopid)==='' && $.trim(cionid)==='' && $.trim(timess)==='' && $.trim(orderid)==='' && $.trim(state)==='' && $.trim(points)==='' && $.trim(userid)==='' ) {
                layer.msg('请输入平台订单号！',{icon:0});
                return;
            }else{
                tableIn.reload({ page: {page: 1},where: {shopid: shopid,cionid: cionid,timess: timess,orderid: orderid,state: state,points: points,userid: userid}});
            } 
        });
        //统计
        totalIn = table.render({ 
            id: '#totals',      
            elem: '#total',
            // toolbar: '#totals',
            url: '{:url("total")}',
            method: 'post', 
            // page: true,
            cols: [[ 
                // {field: 'no', title: '<span style="color: red;">未支付订单金额</span>',align: 'center', width:200, fixed: true},
                // {field: 'yes', title: '<span style="color: green;">已支付订单金额</span>',align: 'center', width:200, fixed: true},
                {field: 'total', title: '<span style="color: green;">已确认订单总额</span>',align: 'center', width: 130, fixed: true},
                {field: 'num', title: '<span style="color: #FF5722;">已确认订单总数</span>',align: 'center', width: 130, fixed: true},
                {field: 'a_money', title: '<span style="color: #FFB800;">代理手续费总额</span>',align: 'center', width: 130, fixed: true},
                {field: 'u_money', title: '<span style="color: #1E9FFF;">码商手续费总额</span>',align: 'center', width: 130, fixed: true},
                {field: 'today_total', title: '<span class="layui-bg-green">当日已确认订单金额</span>',align: 'center', width: 170, fixed: true},
                {field: 'today_num', title: '<span class="layui-bg-red">当日已确认订单数</span>',align: 'center', width: 170, fixed: true},
                {field: 'today_a_money', title: '<span class="layui-bg-orange">当日代理手续费</span>',align: 'center', width: 170, fixed: true},
                {field: 'today_u_money', title: '<span class="layui-bg-blue">当日码商手续费</span>',align: 'center', width: 170, fixed: true},
            ]],
            // limit: 60 //每页默认显示的数量
        });
         $('#totals').on('click', function() {
            var userid = $('#userid').val();
            var shopid = $('#shopid').val();
            var cionid = $('#cionid').val();
            var timess = $('#timess').val();
            var state = $('#state').val();
            var points = $('#points').val();
            var orderid = $('#orderid').val();
            if($.trim(shopid)==='' && $.trim(cionid)==='' && $.trim(timess)==='' && $.trim(orderid)==='' && $.trim(state)==='' && $.trim(points)===''  && $.trim(userid)==='') {
                layer.msg('请输入平台订单号！',{icon:0});
                return;
            }else{
                totalIn.reload({where: {userid: userid,shopid: shopid,cionid: cionid,timess: timess,orderid: orderid,state: state,points: points}});
            } 
        });      
    });
    function orderquan(timessss){
        tableIn.reload({ page: {page: 1},where: {timequan:timessss}}); 
    } 
</script>
</body>
</html>